(function () {
    let init = echarts.init(document.querySelector('#Line'));
    let option = {
        color: ["#00f2f1", "#ed3f35"],
        grid: {
            top: '50px',
            bottom: '50px',
            left: '50px',
            right: '30px'
        },
        legend: {
            // 距离容器10%
            left: "10%",
            top: '5%',
            // 修饰图例文字的颜色
            textStyle: {
                color: "rgba(255,255,255,.7)",
                fontSize: 12
            }
            // 如果series 里面设置了name，此时图例组件的data可以省略
            // data: ["邮件营销", "联盟广告"]
        },
        tooltip: {
            trigger: "axis",
            axisPointer: {
                // 坐标轴指示器，坐标轴触发有效
                type: "shadow" // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        xAxis: [{
            type: 'category',
            axisLabel: {show: true, fontSize: 12},
            data: ["城市A", "城市B", "城市C", "城市D", "城市E", "城市F", "城市G"],
            axisLine: {
                lineStyle: {
                    color: "rgba(255,255,255,.7)"
                }
            },
            boundaryGap: false
        }],
        yAxis: {
            type: 'value',
            axisLabel: {
                interval: 0,
                textStyle: {
                    color: "rgba(255,255,255,.7)"
                },
                fontSize: 12
            },
            axisLine: {
                lineStyle: {
                    color: "rgba(255,255,255,.7)"
                }
            }
        },
        series: [{
            name: '通行总数',
            smooth: true,
            data: [120, 200
                , 150, 80, 70, 110, 130],
            type: 'line',
            stack: '总量',
            showBackground: true,
            label: {
                show: true,
                position: 'top',
                color: '#FFFFFF',
                textStyle: {
                    fontSize: 12
                }
            },
            areaStyle: {}
        }, {
            name: '疑似超限',
            smooth: true,
            areaStyle: {},
            data: [123, 123
                , 123, 123, 123, 123, 123],
            type: 'line',
            stack: '总量',
            showBackground: true,
            label: {
                show: true,
                position: 'top',
                color: '#FFFFFF',
                textStyle: {
                    fontSize: 12
                }
            }
        }]
    }
    let fontChange = function (baseSize) {
        option.legend.textStyle.fontSize = Number((0.747 * baseSize).toFixed(0));
        option.yAxis.axisLabel.fontSize = Number((0.747 * baseSize).toFixed(0));
        option.xAxis[0].axisLabel.fontSize = Number((0.747 * baseSize).toFixed(0));
        option.series[0].label.textStyle.fontSize = Number((0.747 * baseSize).toFixed(0));
        option.series[1].label.textStyle.fontSize = Number((0.747 * baseSize).toFixed(0));
        return option;
    }
    resizeCallBack.push({chart: init, fontChange: fontChange})

    let updateFun = function (xData, passedTotal, overFlowLimit) {
        option.xAxis[0].data = xData;
        option.series[0].data = passedTotal;
        option.series[1].data = overFlowLimit;
        init.setOption(option);
    };
    if (charts1) {
        charts1['12'] = updateFun;
    }

})()